using UnityEngine;

namespace ai_library
{
	public class Message
	{
		public Message(int senderId, int receiverId, MessageTypes message, float delay)
		{
			SenderId = senderId;
			ReceiverId = receiverId;
			Msg = message;
			Delay = MessageDispatcher.Instance.CurrentTime 
					+ Mathf.Clamp(delay, 0.0f, delay);
		}

		public Message(int senderId, int receiverId, MessageTypes message) 
			: this (senderId, receiverId, message, 0.0f)
		{
		}

		public int SenderId
		{
			get; 
			private set;
		}
		
		public int ReceiverId
		{
			get; 
			private set;
		}
		
		public MessageTypes Msg
		{
			get; 
			private set;
		}
		
		public float Delay
		{
			get; 
			private set;
		}

		public override string ToString()
		{
			return 	"Sender: " + SenderId +
					" Receiver: " + ReceiverId + 
					" Msg: " + Msg + 
					" Delay: " + Delay;
		}
	}
}
